/*
 * BSM6.0
 *
 * Copyright 2012-2013 (C) SINODATA CO., LTD. All Rights Reserved.
 */
package com.sinodata.bsm.center.service.probe;

import java.util.List;
import java.util.Map;

import javax.jms.JMSException;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sinodata.bsm.center.message.Messenger;
import com.sinodata.bsm.common.message.ServiceMessage;
import com.sinodata.bsm.common.vo.ResPropertyValue;

/**
 * <p>
 * Description: 
 * </p>
 *
 * @author tangli
 * @version 1.0

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * 2012-5-17 下午1:11:21          tangli         1.0         To create
 * </p>
 *
 * @since 
 * @see     
 */
@Service
@Transactional
public class CollectTestService {

    /**
     * 
     */
    public CollectTestService() {
    }

    public String[] getCollectorParamMeta(Long probeId, String collectorName) {
        ServiceMessage msg = new ServiceMessage();
        msg.setSrvId("CollectorTestService");
        msg.setMethod("getCollectorParamMeta");
        msg.setParams(new Object[] { collectorName });
        try {
            return (String[]) Messenger.getInstance().sendSyncMessage(probeId, msg);
        } catch (JMSException e) {
            return null;
        }
    }

    public List<ResPropertyValue> collect(Long probeId, String collectorName, Map<String, String> params, String ip) {
        ServiceMessage msg = new ServiceMessage();
        msg.setSrvId("CollectorTestService");
        msg.setMethod("collect");
        msg.setParams(new Object[] { collectorName, params, ip });
        try {
            return (List<ResPropertyValue>) Messenger.getInstance().sendSyncMessage(probeId, msg);
        } catch (JMSException e) {
            return null;
        }
    }
}
